import { fetchRequestHandler } from '@trpc/server/adapters/fetch'
import { appRouter } from '@server/routers'
import { createContext } from '@server/trpc/context'

const handler = (req: Request) =>
  fetchRequestHandler({
    endpoint: '/api/trpc',
    req,
    router: appRouter,
    createContext,
    onError: (opt) => {
      console.log(opt);
      
    }
  })

export { handler as GET, handler as POST }